package NICE_CORE

import chisel3.BlackBox
import chisel3._
class aes_top extends BlackBox{
  val io = IO(new Bundle{
    val clk = Input(Clock())
    val rst = Input(Bool())
    val load= Input(Bool())
    val keyload = Input(Bool())
    val length  = Input(UInt(2.W))
    val mode    = Input(Bool())
    val done    = Output(Bool())
    val key_in  = Input(UInt(256.W))
    val text_in = Input(UInt(128.W))
    val text_out= Output(UInt(128.W))
  })
}
class EndianCnvt (NUMLENGTH :Int)extends Module{
  val io = IO(new Bundle {
    val NumIn = Input(UInt(NUMLENGTH.W))
    val NumOut= Output(UInt(NUMLENGTH.W))
  })
  val BYENUM = NUMLENGTH>>3
  val temp =  io.NumIn.asTypeOf(Vec(BYENUM,UInt(8.W)))
  val temp2 = Wire(Vec(BYENUM,UInt(8.W)))
  temp2 := temp.reverse
  io.NumOut := temp2.asUInt()
}

object EndianCnvt{
  def apply(in1:UInt,NUMLENGTH:Int) :UInt={
  val inst = Module(new EndianCnvt(NUMLENGTH))
  inst.io.NumIn := in1
  inst.io.NumOut
}
}
